package cn.wzvtcsoft.sys.service.impl;

import cn.wzvtcsoft.base.BaseServiceImpl;
import cn.wzvtcsoft.common.util.BeanUtil;
import cn.wzvtcsoft.sys.entity.Role;
import cn.wzvtcsoft.sys.entity.RolePermission;
import cn.wzvtcsoft.sys.repository.RoleRepository;
import cn.wzvtcsoft.sys.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleServiceImpl extends BaseServiceImpl<Role, RoleRepository> implements RoleService {

  @Override
  protected void beforeInsertOrUpdate(Role role) {
    for (RolePermission rolePermission : role.getRolePermissions()) {
      rolePermission.setParent(role);
    }
  }

}
